package com.hhsj.dynamicui.model;


import com.hhsj.dynamicui.model.base.JSONAble;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * title : 轮播
 * titleType : 0
 * supportMore : 0
 * moreAction :
 * hight : 20
 * marginLeft : 0
 * marginTop : 0
 * marginRight : 0
 * marginBottom : 0
 * <p>
 * "titleType": "image_title",
 * "title": "这是第二组的带icon的组标题",
 * "titleType": "image_title",
 * "supportMore": "0",
 * "moreAction": "uhome://uhomeopen?action=discover&title=发现"
 */
public final class TitleViewBean implements Serializable, JSONAble {
    private String titleId;//组标题Id

    private String groupId;
    private String pageId;
    private String titleType;

    private String title;
    private String title1;
    private String image;
    private String image1;

    private int supportMore;
    private String moreAction;

    private ViewBean property;

    public String getPageId() {
        return pageId;
    }

    public void setPageId(String pageId) {
        this.pageId = pageId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public void setTitleId(String titleId) {
        this.titleId = titleId;
    }

    public String getTitle1() {
        return title1;
    }

    public void setTitle1(String title1) {
        this.title1 = title1;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getImage1() {
        return image1;
    }

    public void setImage1(String image1) {
        this.image1 = image1;
    }

    public ViewBean getProperty() {
        return property;
    }

    public void setProperty(ViewBean property) {
        this.property = property;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitleType() {
        return titleType;
    }

    public void setTitleType(String titleType) {
        this.titleType = titleType;
    }

    public int getSupportMore() {
        return supportMore;
    }

    public void setSupportMore(int supportMore) {
        this.supportMore = supportMore;
    }

    public String getMoreAction() {
        return moreAction;
    }

    public void setMoreAction(String moreAction) {
        this.moreAction = moreAction;
    }

    public String getGroupId() {
        return groupId;
    }

    public String getTitleId() {
        return titleId;
    }

    @Override
    public String toJSONString() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("title_id", titleId);
        jsonObject.put("group_id", groupId);
        jsonObject.put("page_id", pageId);

        jsonObject.put("title_code", titleType);
        jsonObject.put("title", title);
        jsonObject.put("title1", title1);
        jsonObject.put("image", image);

        jsonObject.put("image1", image1);
        jsonObject.put("support_more", supportMore);
        jsonObject.put("more_action", moreAction);
        if (property != null) {
            jsonObject.put("property", new JSONObject(property.toJSONString()));
        }
        return jsonObject.toString();
    }
}
